package com.mdxx.xczd.manager;

import android.content.Context;

import com.iflytek.speech.SynthesizerPlayer;

/**
 * 语音播报管理
 *
 */
public class SynthesizerManager {

	private Context context;
	private static SynthesizerPlayer synthesizerPlayer;
	private static SynthesizerManager synthesizerManager;
	private static final String APPID = "appid=519328ab";
	
	public static SynthesizerManager getInstatce(Context context){
		if(synthesizerManager == null){
			synchronized (SynthesizerManager.class) {
				if(synthesizerManager == null){
					synthesizerManager = new SynthesizerManager(context);
				}
			}
		}
		return synthesizerManager;
	}
	
	private SynthesizerManager(Context context){
		this.context = context;
		init();
	}
	
	private void init(){
		synthesizerPlayer = SynthesizerPlayer.createSynthesizerPlayer(context, APPID);		
		synthesizerPlayer.setVoiceName("vivixiaoyan");//在此设置语音播报的人选
	}
	 
	public void play(String content){
		synthesizerPlayer.playText(content, "ent=vivi21,bft=5",null);
	}
}
